import request from "@/utils/request";

export function orderCreate({ material_id, payment_type }) {
  return request({
    url: "order/create/",
    method: "post",
    data: {
      material_id,
      payment_type,
    },
  });
}

export function orderCancelPay({ order_number }) {
  return request({
    url: "order/cancel_pay/",
    method: "post",
    data: {
      order_number,
    },
  });
}

export function getOrderPayInfo({ order_number }) {
  return request({
    url: "order/unpaid/",
    method: "get",
    params: {
      order_number,
    },
  });
}

export function getOrderList({ offset, limit, order_status }) {
  return request({
    url: `order/list/`,
    method: "get",
    params: {
      offset,
      limit,
      order_status,
    },
  });
}

export const orderDownload = (order_number) => {
  return request({
    url: `order/download/`,
    method: "get",
    params: {
      order_number,
    },
  });
};

export const orderDetail = (order_number) => {
  return request({
    url: `order/detail/`,
    method: "post",
    data: order_number,
  });
};
